package avicit.bdp.dds.api.service;

import avicit.bdp.common.base.BaseService;
import avicit.bdp.common.service.dto.BdpColumnDTO;
import avicit.bdp.common.utils.BdpLogUtil;
import avicit.bdp.dds.dao.mapper.ModelColumnMapper;
import avicit.platform6.commons.utils.ComUtil;
import avicit.platform6.core.exception.BusinessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-06-24 14:54
 * @类说明：bdp_das_columnService
 * @修改记录：
 */
@Service
public class ModelColumnService extends BaseService<ModelColumnMapper, BdpColumnDTO> {


    /**
     * 新增对象
     *
     * @param modelColumn 保存对象
     * @return String
     */
    @Transactional(rollbackFor = Exception.class)
    public String insertBdpDasColumn(BdpColumnDTO modelColumn) {
        try {
            modelColumn.setId(ComUtil.getId());
            insertSelective(modelColumn);
            //记录日志
            BdpLogUtil.log4Insert(modelColumn);
            return modelColumn.getId();
        } catch (Exception e) {
            throw new BusinessException(e.getMessage(), e);
        }
    }

}